{extend name="public/base" /}
{block name="style"}<link href="__LIB__/fileinput/css/fileinput.min.css" rel="stylesheet" /> {/block}
 {block name="body"}
 <div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('web/index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li>
			<a href="{:url('index')}">会员列表</a>
		</li>
		<li><strong>新增会员</strong></li>
	</ol>
</div>
<div class="ibox float-e-margins">
	<div class="ibox-content">
		<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('add')}">
			<!--基本信息-->
			<div class="panel panel-default">
			<div class="panel-heading"> 基本信息</div>
				<div class="panel-body">
				<div class="form-group">
					<label class="col-sm-3 control-label">姓名：</label>
					<div class="input-group col-sm-4">
						<input type="text" id="real_name" name="real_name" placeholder="请输入姓名"value="" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">手机号：</label>
					<div class="input-group col-sm-4"  >
						<input type="text" id="mobile" name="mobile" placeholder="请输入手机号" value="" onblur="sjyz()" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">性别：</label>
					<div class="input-group col-sm-3">
					<input type="radio" name="sex" value="1" /> 男
					&nbsp;
					<input type="radio" name="sex" value="2" /> 女
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">出生年：</label>
					<div class="input-group col-sm-4">
						<input id='birthday_year' name='birthday_year' value="" onclick="WdatePicker({dateFmt:'yyyy',minDate: '1960',isShowClear:false,readOnly:true})"  type='text' placeholder="" class="form-control layer-date" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">生日：</label>
					<div class="input-group col-sm-4">
						<input id='birthday' name='birthday' value="" onclick="WdatePicker({dateFmt:'MM-dd',readOnly:true})"  type='text' placeholder="" class="form-control layer-date" />
						填写月和日，即可收到生日短信（需要管理员开启短信通知）
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">初始密码：</label>
					<div class="input-group col-sm-4">
						<input type="text" id="password" name="password" value="123456" placeholder="6位数字" class="form-control" />
					</div>
				</div>
			</div>
			</div>
			<!--基本信息end-->
			
			<!--扩展信息-->
			<div class="panel panel-default">
			<div class="panel-heading"> 扩展信息</div>
				<div class="panel-body">
				<div class="form-group">
					<label class="col-sm-3 control-label">电子邮箱：</label>
					<div class="input-group col-sm-4">
						<input type="text" id="email" name="email" value="" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">QQ号：</label>
					<div class="input-group col-sm-4">
						<input type="text" id="qq_account" name="qq_account"  value="" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">微信号：</label>
					<div class="input-group col-sm-4">
						<input type="text" id="wechat_account" name="wechat_account"  value="" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">所在地区：</label>
					<div class="input-group col-sm-4">
						<input type="text" id="member_addarea" name="member_addarea"  value="" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">详细地址：</label>
					<div class="input-group col-sm-4">
						<input type="text" id="address" name="address"  value="" placeholder="街道" class="form-control" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">备注：</label>
					<div class="input-group col-sm-4">
						<textarea id="remarks" name="remarks" rows="5" style="width: 450px;" placeholder="备注"></textarea>
					</div>
				</div>
				</div>
			</div>
			<!--自定义属性end-->
			<div class="hr-line-dashed"></div>
			<div class="form-group">
				<div class="col-sm-4 col-sm-offset-3">
					<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;
					<a href="{:url('index')}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> 返回 </a>
				</div>
			</div>
		</form>
	</div>
</div>
{/block} {block name="script"}
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/datepicker/WdatePicker.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__LIB__/ueditor/ueditor.config.js" type="text/javascript"></script>
<script src="__LIB__/ueditor/ueditor.all.js" type="text/javascript"></script>
<script>
//编辑器
	var ueditor = UE.getEditor('content');
	upload_one('__IMG__/default.jpg');
	
	//验证手机号
	function sjyz(){
		 var phone = document.getElementById('mobile').value;
		 if(phone != ''){
    if(!(/^1[34578]\d{9}$/.test(phone))){ 
       $("#mobile").after("<span class='cl' style='color:red'>请输入正确的手机号码</span>");
   				} 
			}else {
				  $("#mobile").after("<span class='cl' style='color:red'>请输入手机号码</span>");
			}
		}
	//清除弹出的内容
	$("#mobile").focus(function(){
		$('.cl').html('');
		$("#mobile").val('');
		}
	);
	
	$(function() {
		$("#myForm").validate({
			rules: {
				real_name:"required",
				mobile: "required",
				password: "required",
			},
			messages: {
				real_name:ICON.error + "请输入姓名",
				mobile:ICON.error + "请输入手机号码",
				password:ICON.error + "请输入密码"
			},
			submitHandler: function(form) {
				ajaxForm();
			}
		});
	});
</script>
<script>
	function jiancha(){
		var value = document.getElementById("validit").checked;
		if(value == true){
			$("input[name='validity_date']").val('');
			$("input[name='validity_date']").attr('disabled',true);
		}else if(value == false){
			$("input[name='validity_date']").attr('disabled',false);
		}
	}
</script>
{/block}